#!/bin/bash
# The logic to start up your application should be put in this
# script. The application will work only if it binds to
# $OPENSHIFT_INTERNAL_IP:8080
# nohup $OPENSHIFT_REPO_DIR/diy/testrubyserver.rb $OPENSHIFT_INTERNAL_IP $OPENSHIFT_REPO_DIR/diy > $OPENSHIFT_DIY_LOG_DIR/server.log 2>&1 &
# replace the $OPENSHIFT_INTERNAL_IP and $OPENSHIFT_INTERNAL_PORT before starting up the server
sed -e "s/`echo '$OPENSHIFT_IP:$OPENSHIFT_PORT'`/`echo $OPENSHIFT_INTERNAL_IP:$OPENSHIFT_INTERNAL_PORT`/" $OPENSHIFT_DATA_DIR/conf/nginx.conf.template > $OPENSHIFT_DATA_DIR/conf/nginx.conf
#sed -i '46 a\location /mirror {' $OPENSHIFT_DATA_DIR/conf/nginx.conf
#sed -i '47 a\root mirror;' $OPENSHIFT_DATA_DIR/conf/nginx.conf
#sed -i '48 a\index index.html index.htm;' $OPENSHIFT_DATA_DIR/conf/nginx.conf
#sed -i '49 a\autoindex on;' $OPENSHIFT_DATA_DIR/conf/nginx.conf
#sed -i '50 a\autoindex_exact_size off;' $OPENSHIFT_DATA_DIR/conf/nginx.conf
#sed -i '51 a\autoindex_localtime on;' $OPENSHIFT_DATA_DIR/conf/nginx.conf
#sed -i '52 a\}' $OPENSHIFT_DATA_DIR/conf/nginx.conf
sed -i '41 a\        autoindex on;' $OPENSHIFT_DATA_DIR/conf/nginx.conf
sed -i '42 a\        autoindex_exact_size off;' $OPENSHIFT_DATA_DIR/conf/nginx.conf
sed -i '43 a\        autoindex_localtime on;' $OPENSHIFT_DATA_DIR/conf/nginx.conf
nohup $OPENSHIFT_DATA_DIR/sbin/nginx > $OPENSHIFT_DIY_LOG_DIR/server.log 2>&1 &
